﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Admin/Views/Shared/MainContent.Master"
    Inherits="System.Web.Mvc.ViewPage<MShop.Web.Components.Paging.PagedList<MShop.Core.Domain.Product>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    场合分类
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<% using (Html.BeginForm())
   { %>
    <div id="fullBox">
        <div class="tabListBoxHead">
            <div style="float: left; padding-top: 3px;">
                <img src="/Content/add.png" width="16" height="16" border="0" align="absmiddle" style="margin-right: 3px;" />
                <%: Html.SetActionLink("创建场合分类", "create", MShop.Core.Domain.RightFlags.Create)%>
            </div>
            <div style="float: right;">
               <%=Html.DropDownList("cid", ViewData["itemcats"] as IEnumerable<SelectListItem>) %>    
               <input type="submit" class="btn" name="search" value="搜索" />  
               <input type="submit" class="btn" name="add" value="添加到场合分类" />         
               <%: Html.ActionLink("返回", "ProductIndex", new { id =Request["oid"] })%>   
            </div>
        </div>
        <div class="tabListBox">
           
            <table id="ETList" cellpadding="0" cellspacing="0">
                <thead>
                    <tr>
                        <th>
                            <input type="checkbox" id="selAll" />
                        </th>
                        <th>
                            产品分类
                        </th>
                         <th>
                            产品图片
                        </th>    
                        <th>
                            产品名称
                        </th>                        
                        <th>
                            产品价格
                        </th>                       
                    </tr>
                </thead>
                <tbody>
                  <% IQueryable<OccasionProduct> oproducts = ViewData["ossicationproduct"] as IQueryable<OccasionProduct>;  %>
                    <% foreach (var item in Model)
                       { %>
                    <tr>
                        <td>
                            <input type="checkbox" name="pid" value='<%=item.Id %>' />
                        </td>
                        <td>
                            <%: item.CatName%>
                        </td>
                        <td>
                        <img src='<%=item.ThumbImageUrl %>' style="width:60px;height:60px;" alt='<%=item.ProductName%>' />
                        </td>
                        <td>
                            <%=item.ProductName%>
                            <% if (oproducts.FirstOrDefault(x => x.ProductId == item.Id) != null)
                               { %>
                               <span style="color:Red;">已经加入</span>
                            <%} %>
                        </td>
                        <td>
                            <%=item.ShopPrice%>
                        </td>
                    </tr>
                    <% } %>
                </tbody>
            </table>
        </div>
           <%=Html.Pager(Model.PageSize, Model.PageNumber, Model.TotalItemCount, HttpVerbs.Post, "page")%>
        <input type="hidden" name="page" id="page"  />
    </div>
    <%} %>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cphMeta" runat="server">
    <script type="text/javascript">
        $(document).ready(function () {
            var windowWidth = $("#fullBox").width();
            var windowHeight = $("#fullBox").height() - 60;
            $('.tabListBox').css({ 'width': windowWidth + 'px', 'height': windowHeight + 'px' });
            $(window).resize(function () {
                var windowWidth = $("#fullBox").width();
                var windowHeight = $("#fullBox").height() - 60;
                $('.tabListBox').css({ 'width': windowWidth + 'px', 'height': windowHeight + 'px' });
            });
            $('.tabListBox').fixedHeaderTable({ footer: false, cloneHeaderToFooter: false, autoResize: true, fixCol1: true });

            $('.tabListBox').find("tbody").find("tr").each(function (i) {
                if (i % 2 == 1) {
                    $(this).find("td").addClass("tr1");
                }
            });
            $('.tabListBox').find("tbody").find("tr").mouseover(function (i) {
                $(this).find("td").addClass("tr0");
            });
            $('.tabListBox').find("tbody").find("tr").mouseout(function (i) {
                $(this).find("td").removeClass("tr0");
            });

            $('#selAll').change(function () {
                var ele = $("input[name='pid']");
                ele.attr("checked", $('#selAll').attr("checked"));
            });     
        });

       
    </script>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="cphFooter" runat="server">
</asp:Content>
